!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=64)}([function(e,t){e.exports=lodash},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.hooks},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=wp.data},function(e,t){e.exports=cf.core},function(e,t){e.exports=wp.element},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(46),o=n(1);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(47);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t){e.exports=wp.components},function(e,t,n){var r=n(4);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){r(e,t,n[t])})}return e}},function(e,t){e.exports=wp.editor},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=cf.vendor.immer},function(e,t,n){e.exports={forEach:n(25),fromObs:n(26),fromIter:n(27),fromEvent:n(28),fromPromise:n(29),interval:n(30),map:n(31),scan:n(32),flatten:n(33),take:n(34),skip:n(35),filter:n(36),merge:n(37),concat:n(38),combine:n(39),share:n(40),pipe:n(41)}},function(e,t){e.exports=wp.compose},function(e,t,n){var r=n(43),o=n(44),i=n(45);e.exports=function(e){return r(e)||o(e)||i()}},function(e,t){e.exports=wp.date},function(e,t,n){var r;
/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var c=o.apply(null,r);c&&e.push(c)}else if("object"===i)for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=wp.apiFetch},function(e,t){e.exports=(e=>t=>{let n;t(0,(t,r)=>{0===t&&(n=r),1===t&&e(r),1!==t&&0!==t||n(1)})})},function(e,t){e.exports=(e=>(t,n)=>{if(0!==t)return;let r;n(0,e=>{2===e&&r&&(r.unsubscribe?r.unsubscribe():r())}),r=e.subscribe({next:e=>n(1,e),error:e=>n(2,e),complete:()=>n(2)})})},function(e,t){e.exports=(e=>(t,n)=>{if(0!==t)return;const r="undefined"!=typeof Symbol&&e[Symbol.iterator]?e[Symbol.iterator]():e;let o,i=!1,c=!1;n(0,e=>{1===e&&(c=!0,i||o&&o.done||function(){for(i=!0;c;)c=!1,(o=r.next()).done?n(2):n(1,o.value);i=!1}())})})},function(e,t){e.exports=((e,t)=>(n,r)=>{if(0!==n)return;const o=e=>r(1,e);r(0,n=>{2===n&&e.removeEventListener(t,o)}),e.addEventListener(t,o)})},function(e,t){e.exports=(e=>(t,n)=>{if(0!==t)return;let r=!1;e.then(e=>{r||(n(1,e),n(2))},e=>{r||n(2,e)}),n(0,e=>{2===e&&(r=!0)})})},function(e,t){e.exports=(e=>(t,n)=>{if(0!==t)return;let r=0;const o=setInterval(()=>{n(1,r++)},e);n(0,e=>{2===e&&clearInterval(o)})})},function(e,t){e.exports=(e=>t=>(n,r)=>{0===n&&t(0,(t,n)=>{r(t,1===t?e(n):n)})})},function(e,t){e.exports=function(e,t){let n=2===arguments.length;return r=>(o,i)=>{if(0!==o)return;let c=t;r(0,(t,r)=>{1===t?(c=n?e(c,r):(n=!0,r),i(1,c)):i(t,r)})}}},function(e,t){e.exports=(e=>(t,n)=>{if(0!==t)return;const r=e=>void 0!==e,o=e=>void 0===e,i=()=>{};let c,l,a=!1;function s(e){1===e&&(l||c||i)(1),2===e&&(l&&l(2),c&&c(2))}e(0,(e,t)=>{if(0===e)c=t,n(0,s);else if(1===e){const e=t;l&&l(2),e(0,(e,t)=>{0===e?(l=t)(1):1===e?n(1,t):2===e&&o(t)?a?n(2):(l=void 0,c(1)):2===e&&r(t)&&n(2,t)})}else 2===e&&o(t)?l?a=!0:n(2):2===e&&r(t)&&n(2,t)})})},function(e,t){e.exports=(e=>t=>(n,r)=>{if(0!==n)return;let o,i=0;function c(t,n){i<e&&o(t,n)}t(0,(t,n)=>{0===t?(o=n,r(0,c)):1===t?i<e&&(i++,r(t,n),i===e&&(r(2),o(2))):r(t,n)})})},function(e,t){e.exports=(e=>t=>(n,r)=>{if(0!==n)return;let o,i=0;t(0,(t,n)=>{0===t?(o=n,r(t,n)):1===t&&i<e?(i++,o(1)):r(t,n)})})},function(e,t){e.exports=(e=>t=>(n,r)=>{if(0!==n)return;let o;t(0,(t,n)=>{0===t?(o=n,r(t,n)):1===t?e(n)?r(t,n):o(1):r(t,n)})})},function(e,t){e.exports=function(...e){return(t,n)=>{if(0!==t)return;const r=e.length,o=new Array(r);let i=0,c=0;const l=e=>{if(0!==e)for(let t=0;t<r;t++)o[t]&&o[t](e)};for(let t=0;t<r;t++)e[t](0,(e,a)=>{0===e?(o[t]=a,1==++i&&n(0,l)):2===e?(o[t]=void 0,++c===r&&n(2)):n(e,a)})}}},function(e,t){e.exports=((...e)=>(t,n)=>{if(0!==t)return;const r=e.length;if(0===r)return n(0,()=>{}),void n(2);let o,i=0;const c=(e,t)=>{1!==e&&2!==e||o(e,t)};!function t(){i!==r?e[i](0,(e,r)=>{0===e?(o=r,0===i?n(0,c):o(1)):1===e?n(1,r):2===e&&(i++,t())}):n(2)}()})},function(e,t){const n={};e.exports=((...e)=>(t,r)=>{if(0!==t)return;const o=e.length;if(0===o)return r(0,()=>{}),r(1,[]),void r(2);let i=o,c=o,l=o;const a=new Array(o),s=new Array(o),u=(e,t)=>{if(2===e)for(let e=0;e<o;e++)s[e](2)};e.forEach((e,t)=>{a[t]=n,e(0,(e,f)=>{if(0===e)s[t]=f,0==--i&&r(0,u);else if(1===e){const e=c?a[t]===n?--c:c:0;if(a[t]=f,0===e){const e=new Array(o);for(let t=0;t<o;++t)e[t]=a[t];r(1,e)}}else 2===e?0==--l&&r(2):r(e,f)})})})},function(e,t){e.exports=(e=>{let t,n=[];return function(r,o){if(0!==r)return;n.push(o);const i=(e,r)=>{if(0!==e)if(2===e){const e=n.indexOf(o);e>-1&&n.splice(e,1),n.length||t(2)}else t(e,r)};1!==n.length?o(0,i):e(0,(e,r)=>{if(0===e)t=r,o(0,i);else for(let t of n.slice(0))t(e,r);2===e&&(n=[])})}})},function(e,t){e.exports=function(...e){let t=e[0];for(let n=1,r=e.length;n<r;n++)t=e[n](t);return t}},function(e,t,n){},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(e){return n(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},r(t)}e.exports=r},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"setupContainerDefinitions",function(){return $}),n.d(r,"setupFieldDefinitions",function(){return H});var o={};n.r(o),n.d(o,"getContainerDefinitionByBlockName",function(){return z}),n.d(o,"getFieldDefinitionsByBlockName",function(){return J});var i=n(15),c=n.n(i),l=n(5),a=n(17),s=n(2),u=n(0),f=n(20),p=n(3),d=n(6),b=function(e,t){return e===t},m=n(19);function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Object(u.mapKeys)(e,function(e,n){return"".concat(Object(u.repeat)("parent.",t)).concat(n)})}function v(e){return Object(u.startsWith)(e,"cf-")}var y=Object(d.withConditionalLogic)(function(e){return Object(m.pipe)(Object(d.fromSelector)(Object(l.select)("core/editor").getBlock,e.blockId),function(e){return void 0===e&&(e=b),function(t){return function(n,r){if(0===n){var o,i,c=!1;t(0,function(t,n){0===t&&(i=n),1===t?c&&e(o,n)?i(1):(c=!0,o=n,r(1,n)):r(t,n)})}}}}(),Object(m.map)(function(e){return e.attributes.data}))},function(e,t){var n={};if(Object(u.has)(t,e.field.base_name))n=h(Object(u.omit)(t,[e.field.base_name]));else{var r=e.id.split("__");r.shift();var o=r.shift();r.pop();var i=r.reduce(function(e,t){return v(t)?e:e+1},0);n=h(n=Object(u.omit)(t,[o]),i+1);for(var c=o;r.length>0;){var l=r.shift(),a=v(l),s=!a;if(a){var f=Object(u.findIndex)(Object(u.get)(t,c),["_id",l]);c="".concat(c,".").concat(f);var p=Object(u.get)(t,c);p=h(p=Object(u.omit)(p,["_id","_type",e.field.base_name]),i),Object(u.assign)(n,p)}s&&(c="".concat(c,".").concat(l),i--)}}return n});n(42),Object(p.addFilter)("carbon-fields.association.block","carbon-fields/blocks",Object(d.withProps)(function(e){return{hierarchyResolver:function(){var t=Object(l.select)("core/editor").getBlock(e.blockId),n=e.id.split("__");n.shift();for(var r=n.shift(),o="data.".concat(r);n.length>0;){var i=n.shift();if(0===i.indexOf("cf-")){var c=Object(u.get)(t.attributes,"".concat(o)),a=Object(u.find)(c,["_id",i]),s=c.indexOf(a);o="".concat(o,".").concat(s),r="".concat(r,"[").concat(s,"]:").concat(a._type,"/")}else o="".concat(o,".").concat(i),r="".concat(r).concat(i)}return r}}}));var g=n(21),O=n.n(g),_=n(8),k=n.n(_),j=n(9),w=n.n(j),x=n(10),E=n.n(x),S=n(11),I=n.n(S),F=n(12),C=n.n(F),G=n(1),T=n.n(G),N=n(4),B=n.n(N),P=n(18),A=n.n(P),D=n(7),M=(n(48),n(49),Object(d.withFilters)("carbon-fields.field-wrapper.block")(d.Field)),L=function(e){function t(){var e,n;k()(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=E()(this,(e=I()(t)).call.apply(e,[this].concat(o))),B()(T()(T()(n)),"state",{collapsedGroups:n.props.value.reduce(function(e,t){var r=t._id,o=t._type;return Object(u.find)(n.props.field.groups,["name",o]).collapsed?e.concat(r):e},[])}),B()(T()(T()(n)),"handleAddGroup",function(e,t){var r=n.props,o=r.id,i=r.value,c=r.onChange,l={};l._id=Object(d.uniqueId)(),l._type=e.name,e.fields.reduce(function(e,t){return e[t.base_name]=t.default_value,e},l),c(o,i.concat(l)),t(l)}),B()(T()(T()(n)),"handleCloneGroup",function(e,t){var r=n.props,o=r.id,i=r.value,c=r.onChange,l=i.indexOf(e),a=Object(u.cloneDeep)(e);a._id=Object(d.uniqueId)(),c(o,A()(i,function(e){e.splice(l+1,0,a)})),t(a)}),B()(T()(T()(n)),"handleRemoveGroup",function(e){var t=n.props,r=t.id,o=t.value,i=t.onChange,c=Object(u.findIndex)(o,["_id",e._id]);i(r,A()(o,function(e){e.splice(c,1)})),n.setState(function(t){var n=t.collapsedGroups;return{collapsedGroups:Object(u.without)(n,e._id)}})}),B()(T()(T()(n)),"handleToggleGroup",function(e){n.setState(function(t){var n=t.collapsedGroups;return{collapsedGroups:n=n.indexOf(e)>-1?Object(u.without)(n,e):O()(n).concat([e])}})}),B()(T()(T()(n)),"handleToggleAllGroups",function(){var e=n.props.value;n.setState(function(t){var n=t.collapsedGroups;return{collapsedGroups:n=n.length!==e.length?e.map(function(e){return e._id}):[]}})}),B()(T()(T()(n)),"handleGroupSetup",function(e,t){var r=Object(u.get)(Object(u.find)(n.props.field.groups,["name",e._type]),"fields",[]),o=Object(u.omit)(e,["_id","_type"]);return Object(u.assign)({},t,{id:e._id,fields:r,collapsed:n.state.collapsedGroups.indexOf(e._id)>-1,context:"block",values:o})}),B()(T()(T()(n)),"handleGroupFieldSetup",function(e,t,r){var o=n.props.blockId,i="".concat(n.props.id,"__").concat(r.id,"__").concat(e.base_name),c=Object(u.get)(r,"values.".concat(e.base_name));return[M,Object(u.assign)({},t,{key:i,id:i,name:e.base_name,containerId:n.props.containerId,blockId:o,field:e,value:c,onChange:n.handleGroupFieldChange})]}),B()(T()(T()(n)),"handleGroupFieldChange",function(e,t){var r=n.props,o=r.id,i=r.value;(0,r.onChange)(o,A()(i,function(n){var r=e.split("__"),o=r.pop(),i=Object(u.find)(n,["_id",r.pop()]);Object(u.set)(i,o,t)}))}),n}return C()(t,e),w()(t,[{key:"getGroupValues",value:function(){return this.props.value.map(function(e){var t=Object(u.mapKeys)(Object(u.omit)(e,["_id","_type"]),function(e,t){return t.replace(/\-/g,"_")});return[e._type,t]})}},{key:"render",value:function(){var e=this.handleGroupSetup,t=this.handleGroupFieldSetup,n=this.handleAddGroup,r=this.handleCloneGroup,o=this.handleRemoveGroup,i=this.handleToggleGroup,c=this.handleToggleAllGroups,l=this.props,a=l.value;return(0,l.children)({groupValues:this.getGroupValues(),allGroupsAreCollapsed:this.state.collapsedGroups.length===a.length,handleGroupSetup:e,handleGroupFieldSetup:t,handleAddGroup:n,handleCloneGroup:r,handleRemoveGroup:o,handleToggleGroup:i,handleToggleAllGroups:c})}}]),t}(D.Component);Object(p.addFilter)("carbon-fields.complex.block","carbon-fields/blocks",function(e){return function(t){var n=t.id,r=t.name,o=t.value,i=t.error,c=t.field;return wp.element.createElement(L,t,function(l){var a=l.groupValues,s=l.allGroupsAreCollapsed,u=l.handleGroupSetup,f=l.handleGroupFieldSetup,p=l.handleAddGroup,d=l.handleCloneGroup,b=l.handleRemoveGroup,m=l.handleToggleGroup,h=l.handleToggleAllGroups;return wp.element.createElement(e,{groupIdKey:"_id",groupFilterKey:"_type",id:n,name:r,value:o,error:i,field:c,groupValues:a,allGroupsAreCollapsed:s,onGroupSetup:u,onGroupFieldSetup:f,onAddGroup:p,onCloneGroup:d,onRemoveGroup:b,onToggleGroup:m,onToggleAllGroups:h,onChange:t.onChange})})}});var R=n(13),U=n.n(R),q=n(22),V=(n(50),function(e){function t(){var e,n;k()(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=E()(this,(e=I()(t)).call.apply(e,[this].concat(o))),B()(T()(T()(n)),"handleChange",function(e,t){var r=n.props,o=r.id,i=r.onChange,c=r.value,l=r.field,a=Object(q.format)(l.storage_format,t);a!==c&&i(o,a)}),n}return C()(t,e),w()(t,[{key:"render",value:function(){var e=this.handleChange;return(0,this.props.children)({handleChange:e})}}]),t}(D.Component));Object(p.addFilter)("carbon-fields.date_time.block","carbon-fields/blocks",function(e){return function(t){return wp.element.createElement(V,t,function(n){var r=n.handleChange;return wp.element.createElement(e,U()({buttonText:Object(s.__)("Select Date","carbon-fields-ui")},t,{onChange:r}))})}}),Object(p.addFilter)("carbon-fields.date.block","carbon-fields/blocks",function(e){return function(t){return wp.element.createElement(V,t,function(n){var r=n.handleChange;return wp.element.createElement(e,U()({},t,{onChange:r}))})}}),Object(p.addFilter)("carbon-fields.time.block","carbon-fields/blocks",function(e){return function(t){return wp.element.createElement(V,t,function(n){var r=n.handleChange;return wp.element.createElement(e,U()({},t,{onChange:r}))})}}),n(51),Object(p.addFilter)("carbon-fields.file.block","carbon-fields/blocks",function(e){return function(t){return wp.element.createElement(e,U()({buttonLabel:Object(s.__)("Select File","carbon-fields-ui"),mediaLibraryButtonLabel:Object(s.__)("Use File","carbon-fields-ui"),mediaLibraryTitle:Object(s.__)("Select File","carbon-fields-ui")},t))}});var K=function(e){var t=e.type;return wp.element.createElement("em",null,Object(s.sprintf)(Object(s.__)("Field of type '%s' is not supported in Gutenberg.","carbon-fields-ui"),[t]))};Object(p.addFilter)("carbon-fields.footer_scripts.block","carbon-fields/blocks",function(){return function(e){return wp.element.createElement(K,{type:e.field.type})}}),Object(p.addFilter)("carbon-fields.header_scripts.block","carbon-fields/blocks",function(){return function(e){return wp.element.createElement(K,{type:e.field.type})}}),Object(p.addFilter)("carbon-fields.hidden.block","carbon-fields/blocks",function(){return function(e){return wp.element.createElement(K,{type:e.field.type})}}),Object(p.addFilter)("carbon-fields.image.block","carbon-fields/blocks",function(e){return function(t){return wp.element.createElement(e,U()({buttonLabel:Object(s.__)("Select Image","carbon-fields-ui"),mediaLibraryButtonLabel:Object(s.__)("Use Image","carbon-fields-ui"),mediaLibraryTitle:Object(s.__)("Select Image","carbon-fields-ui")},t))}}),n(52),n(53),n(54),Object(p.addFilter)("carbon-fields.media_gallery.block","carbon-fields/blocks",function(e){return function(t){return wp.element.createElement(e,U()({buttonLabel:Object(s.__)("Select Attachments","carbon-fields-ui"),mediaLibraryButtonLabel:Object(s.__)("Use Attachments","carbon-fields-ui"),mediaLibraryTitle:Object(s.__)("Select Attachments","carbon-fields-ui")},t))}}),n(55),n(56),n(57),n(58),n(59),Object(p.addFilter)("carbon-fields.sidebar.block","carbon-fields/blocks",function(){return function(e){return wp.element.createElement(K,{type:e.field.type})}}),n(60),n(61),n(62),Object(p.addFilter)("carbon-fields.field-edit.block","carbon-fields/blocks",Object(f.compose)(y,Object(l.withDispatch)(function(e){var t=e("core/editor");return{lockSaving:t.lockPostSaving,unlockSaving:t.unlockPostSaving}}),d.withValidation));var W=Object(l.combineReducers)({containerDefinitionsByBlockName:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SETUP_CONTAINER_DEFINITIONS":return t.payload.definitions;default:return e}},fieldDefinitionsByBlockName:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SETUP_FIELD_DEFINITIONS":return t.payload.definitions;default:return e}}});function $(e){return{type:"SETUP_CONTAINER_DEFINITIONS",payload:{definitions:e}}}function H(e){return{type:"SETUP_FIELD_DEFINITIONS",payload:{definitions:e}}}function z(e,t){return e.containerDefinitionsByBlockName[t.replace("carbon-fields/","")]||{}}function J(e,t){return e.fieldDefinitionsByBlockName[t.replace("carbon-fields/","")]||[]}Object(l.registerStore)("carbon-fields/blocks",{reducer:W,actions:r,selectors:o});var Q=n(23),X=n.n(Q),Y=n(14),Z=n(16),ee=(n(63),n(24)),te=n.n(ee),ne=function(e){function t(){var e,n;k()(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=E()(this,(e=I()(t)).call.apply(e,[this].concat(o))),B()(T()(T()(n)),"state",{response:null}),n}return C()(t,e),w()(t,[{key:"componentDidMount",value:function(){this.isStillMounted=!0,this.fetch(this.props),this.fetch=Object(u.debounce)(this.fetch,500)}},{key:"componentWillUnmount",value:function(){this.isStillMounted=!1}},{key:"componentDidUpdate",value:function(e){Object(u.isEqual)(e,this.props)||this.fetch(this.props)}},{key:"fetch",value:function(e){var t=this;if(this.isStillMounted){null!==this.state.response&&this.setState({response:null});var n=e.block,r=this.currentFetchRequest=te()({method:"post",path:"/carbon-fields/v1/block-renderer",data:{name:n.name,content:Object(a.serialize)([n])}}).then(function(e){t.isStillMounted&&r===t.currentFetchRequest&&e&&e.rendered&&t.setState({response:e.rendered})}).catch(function(e){t.isStillMounted&&r===t.currentFetchRequest&&t.setState({response:{error:!0,errorMsg:e.message}})})}}},{key:"render",value:function(){var e=this.state.response,t=this.props.className;return e?e.error?wp.element.createElement(Y.Placeholder,{className:t},Object(s.sprintf)(Object(s.__)("Error loading block: %s","carbon-fields-ui"),e.errorMsg)):e.length?wp.element.createElement(D.RawHTML,{key:"html",className:t},e):wp.element.createElement(Y.Placeholder,{className:t},Object(s.__)("No results found.","carbon-fields-ui")):wp.element.createElement(Y.Placeholder,{className:t},wp.element.createElement(Y.Spinner,null))}}]),t}(D.Component),re=Object(l.withSelect)(function(e,t){var n=t.clientId;return{block:(0,e("core/editor").getBlock)(n)}})(ne),oe=function(e){function t(){var e,n;k()(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=E()(this,(e=I()(t)).call.apply(e,[this].concat(o))),B()(T()(T()(n)),"state",{mode:n.props.container.settings.mode,currentTab:n.props.supportsTabs?Object.keys(n.props.container.settings.tabs)[0]:null}),B()(T()(T()(n)),"handleFieldChange",function(e,t){var r=n.props,o=r.attributes,i=r.setAttributes,l=e.replace(/^.+__(.+)?$/,"$1");i({data:c()({},o.data,B()({},l,t))})}),B()(T()(T()(n)),"handleModeChange",function(){n.setState({mode:n.isInEditMode?"preview":"edit"})}),B()(T()(T()(n)),"handleTabChange",function(e){n.setState({currentTab:e})}),B()(T()(T()(n)),"renderField",function(e,t){var r=n.props,o=r.clientId,i=r.container,c=r.attributes,l=Object(d.getFieldType)(e.type,"block");if(!l)return null;var a="cf-".concat(o,"__").concat(e.base_name),s=Object(u.get)(c.data,e.base_name,e.default_value);return wp.element.createElement(M,{key:t,id:a,field:e},wp.element.createElement(l,{id:a,containerId:i.id,blockId:o,value:s,field:e,name:e.base_name,onChange:n.handleFieldChange}))}),n}return C()(t,e),w()(t,[{key:"renderTabbedFields",value:function(e){var t=this,n=this.props.fields;return Object(u.map)(e,function(e,r){var o=Object(u.find)(n,["name",e]);return t.renderField(o,r)})}},{key:"renderNonTabbedFields",value:function(){return wp.element.createElement("div",{className:"cf-block__fields"},this.props.fields.map(this.renderField))}},{key:"render",value:function(){var e=this,t=this.state.currentTab,n=this.props,r=n.clientId,o=n.container,i=n.supportsTabs,c=n.supportsPreview,l=n.supportsInnerBlocks&&this.isInEditMode&&wp.element.createElement("div",{className:"cf-block__inner-blocks"},wp.element.createElement(Z.InnerBlocks,{template:o.settings.inner_blocks.template,templateLock:o.settings.inner_blocks.template_lock,allowedBlocks:o.settings.inner_blocks.allowed_blocks}));return wp.element.createElement(D.Fragment,null,"above"===o.settings.inner_blocks.position&&l,c&&wp.element.createElement(Z.BlockControls,null,wp.element.createElement(Y.Toolbar,{controls:[{icon:this.isInEditMode?"visibility":"hidden",title:this.isInEditMode?Object(s.__)("Show preview","carbon-fields-ui"):Object(s.__)("Hide preview","carbon-fields-ui"),onClick:this.handleModeChange}]})),this.isInEditMode&&i&&wp.element.createElement("div",{className:"cf-block__tabs"},wp.element.createElement("ul",{className:"cf-block__tabs-list"},Object(u.map)(o.settings.tabs,function(n,r){var o=X()("cf-block__tabs-item",{"cf-block__tabs-item--current":r===t});return wp.element.createElement("li",{key:r,className:o,onClick:function(){return e.handleTabChange(r)}},r)}))),this.isInEditMode&&(i?Object(u.map)(o.settings.tabs,function(n,r){return wp.element.createElement("div",{className:"cf-block__fields",key:r,hidden:r!==t},e.renderTabbedFields(n))}):this.renderNonTabbedFields()),this.isInPreviewMode&&wp.element.createElement("div",{className:"cf-block__preview"},wp.element.createElement(re,{clientId:r})),"below"===o.settings.inner_blocks.position&&l,this.isInPreviewMode&&wp.element.createElement(Z.InspectorControls,null,i?Object(u.map)(o.settings.tabs,function(t,n){return wp.element.createElement(Y.PanelBody,{key:n,title:n},wp.element.createElement("div",{className:"cf-block__fields"},e.renderTabbedFields(t)))}):wp.element.createElement(Y.PanelBody,{title:Object(s.__)("Fields","carbon-fields-ui")},this.renderNonTabbedFields())))}},{key:"isInEditMode",get:function(){return"edit"===this.state.mode}},{key:"isInPreviewMode",get:function(){return"preview"===this.state.mode}}]),t}(D.Component),ie=Object(l.withSelect)(function(e,t){var n=t.clientId,r=t.name,o=e("core/blocks").hasBlockSupport,i=e("core/editor").getBlockRootClientId,c=e("carbon-fields/blocks"),l=c.getContainerDefinitionByBlockName,a=c.getFieldDefinitionsByBlockName,s=i(n);return{container:l(r),fields:a(r),supportsTabs:o(r,"tabs"),supportsPreview:o(r,"preview")&&!s,supportsInnerBlocks:o(r,"innerBlocks")}})(oe),ce=function(e){function t(){return k()(this,t),E()(this,I()(t).apply(this,arguments))}return C()(t,e),w()(t,[{key:"render",value:function(){return null}}]),t}(D.Component);wp.hooks.addFilter("blocks.getSaveElement","carbon-fields/blocks",function(e,t){return/^carbon\-fields\/.+$/.test(t.name)&&t.supports.innerBlocks?wp.element.createElement(Z.InnerBlocks.Content,null):e});var le=ce;Object(s.setLocaleData)(window.cf.config.locale,"carbon-fields-ui");var ae={},se={};Object(u.get)(window.cf,"preloaded.blocks",[]).forEach(function(e){var t=Object(u.kebabCase)(e.id).replace("carbon-fields-container-",""),n=function(e){return e.reduce(function(e,t){return c()({},e,B()({},t.base_name,t.default_value))},{})}(e.fields),r=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object(u.get)(e,"settings.".concat(t),n)};ae[t]=e,se[t]=e.fields.map(function(e){return c()({},e)}),Object(a.registerBlockType)("carbon-fields/".concat(t),{title:e.title,icon:r("icon"),parent:r("parent",[]),category:r("category.slug"),keywords:r("keywords",[]),description:r("description",""),attributes:{data:{type:"object",default:n}},supports:{tabs:Object(u.isPlainObject)(r("tabs")),preview:r("preview"),innerBlocks:r("inner_blocks.enabled"),alignWide:!1,anchor:!1,html:!1},edit:ie,save:le})}),Object(l.dispatch)("carbon-fields/blocks").setupContainerDefinitions(ae),Object(l.dispatch)("carbon-fields/blocks").setupFieldDefinitions(se)}]);